function s(){
    var ul = document.querySelectorAll("#ul li");
    var span = document.querySelector("#span9");
    var span_all = 0;
    for(var i = 0;i<ul.length;i++){
        //单价
        console.log(ul[i].children[0].children[0].children[2].children[0].innerHTML);
        //数量
        console.log(ul[i].children[0].children[0].children[3].children[0].value);
        //小计
        console.log(ul[i].children[0].children[0].children[4].children[0].innerHTML);

        var dan = ul[i].children[0].children[0].children[2].children[0].innerHTML;

        var num = ul[i].children[0].children[0].children[3].children[0].value;


        var to_1 = ul[i].children[0].children[0].children[4].children[0].innerHTML = dan * num;


        span_all += to_1

    }
    span.innerHTML = span_all;
    span.innerHTML = span_all.toFixed(2)

}
s();


var input = document.querySelectorAll("#ul .input");
for(var j = 0;j<input.length;j++){
    input[j].addEventListener('change',s)
}


var span2 = document.querySelectorAll("#ul .del");
for(var k = 0;k<span2.length;k++){
    span2[k].addEventListener('click',function(){
        console.log(this.parentNode.parentNode.parentNode.parentNode.parentNode);
        this.parentNode.parentNode.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode.parentNode.parentNode);
        s()
    })
}



